package com.danskin.wechat.dao;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;

import com.danskin.wechat.entity.CustInfoEx;
import com.danskin.wechat.entity.CustInfoExView;
import com.danskin.wechat.entity.example.CustInfoExExample;

public interface CustInfoExDao {
	
	/**
	 * 查询符合条件的用户扩展信息数据数
	 * @param param
	 * @return
	 * @author makunsmac
	 */
	int selectCountByExample(CustInfoEx param);

	CustInfoEx queryCustInfoEx(@Param("appId") String appId, @Param("openId") String openId);

	/**
	 * 根据openId获取会员可用积分、会员等级
	 * @param openId
	 * @return
	 * @author likui.liu
	 */
	CustInfoEx selectByOpenId(@Param("openId") String openId);

	Map<String, Object> queryCustVipLevel(@Param("openId") String openId);

	CustInfoEx selectByCustId(@Param("mpId") int mpId, @Param("custId") int custId);

	public CustInfoEx queryByMemberId(@Param("mpId") int mpId, @Param("memberId") String memberId);


	public CustInfoEx queryByWxOpenId(@Param("wxOpenId") String wxOpenId);
	
	int insertSelective(CustInfoEx entity);

	public Integer save(CustInfoEx custInfoEx);

	/**
	 * 根据ID查询对象
	 * 
	 * @param Id
	 * @return
	 */
	public CustInfoEx selectCustInfoExById(Integer primeKey);

	public CustInfoExView selectCustByMemberId(@Param("mpId") Integer mpId, @Param("memberId") String memberId);

	public CustInfoExView selectByMemberId(@Param("brandId") String brandId, @Param("memberId") String memberId);

	public CustInfoExView selectCustByOpenId(@Param("mpId") Integer mpId, @Param("openId") String openId);

	/**
	 * 根据查询对象和分页条件，查询平台用户list
	 * 
	 * @param custInfoEx
	 * @return
	 */
	public List<CustInfoEx> selectCustInfoExList(CustInfoEx custInfoEx);

	/**
	 * 更新用户
	 * 
	 * @param custInfoEx
	 */
	public int updateCustInfoEx(CustInfoEx custInfoEx);

	/**
	 * 更新用户
	 * 
	 * @param custInfoEx
	 */
	public int updateByPrimaryKeySelective(CustInfoEx custInfoEx);

	public int updateByPrimaryKeySelective2(CustInfoEx custInfoEx);

	CustInfoEx queryCustInfoExById(@Param("openId") String openId);

	int countByExample(CustInfoExExample example);

	int deleteByExample(CustInfoExExample example);

	int deleteByPrimaryKey(Integer id);

	int insert(CustInfoEx record);

	List<CustInfoEx> selectByExample(CustInfoExExample example);

	CustInfoEx selectByPrimaryKey(Integer id);

	int updateByExampleSelective(@Param("record") CustInfoEx record, @Param("example") CustInfoExExample example);

	int updateByExample(@Param("record") CustInfoEx record, @Param("example") CustInfoExExample example);

	int updateByPrimaryKey(CustInfoEx record);

	void updateCustInfoExAvaPoints(CustInfoEx custInfoEx);

}
